function Bullet() {
	var self = this;
	self.body = document.createElement("div")
	self.init = function() {
		self.body.className = "bullet"
		ge.body.appendChild(self.body)
		self.body.style.left = myplane.left() + myplane.width() / 2 - self.width() / 2 + "px"
		self.body.style.top = myplane.top() - self.height() + "px"
		return self;
	}
	self.move = function(i) {
		self.timer = setInterval(function() {
			if(!GameEngine.pause){
				self.body.style.top = self.top() - 20 + "px"
				if(i%2){
		            self.body.style.left = self.left()+ 3*(parseInt(i/2)+1)+"px";
				}else{
					self.body.style.left = self.left()- 3*parseInt(i/2)+"px";
				}
				ge.notify(self) //检测碰撞
				if(self.top() < -self.height()) {
					self.destroy();
					clearInterval(self.timer)
				}
				if(self.left()<0-self.width()||self.left()>ge.width()){
					self.destroy();
					clearInterval(self.timer)
				}
			}
		}, 50)
	}
	self.destroy = function() {
		self.body.remove()
	}
	self.top = function(val) {
		if(val != undefined) {
			self.body.style.top = val + "px"
		} else {
			return self.body.offsetTop
		}
	}
	self.left = function(val) {
		if(val != undefined) {
			self.body.style.left = val + "px"
		} else {
			return self.body.offsetLeft
		}
	}
	self.width = function() {
		return self.body.offsetWidth
	}
	self.height = function() {
		return self.body.offsetHeight
	}
	self.explode = function() {
		clearInterval(self.timer)
		var [oldwidth, oldheight] = [self.width(), self.height()]
		self.body.className = "bullet_die"
			//调整位置
		self.left(self.left() - self.width() / 2 + oldwidth / 2)
		self.top(self.top() - self.height() / 2 + oldheight / 2)
			//爆炸动画
		var index=1
		self.exptimer=setInterval(function(){
			if(!GameEngine.pause){
				self.body.style.background="url(images/die"+ index++ +".png)"
				if(index>2){
					clearInterval(self.exptimer)
					self.destroy()
				}
			}
		},50)
	}
}